<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<jsp:include page="/common/base.jsp"></jsp:include>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<script type="text/javascript">

function query(){
    $("#listTable").datagrid({
        url:"<c:url value='/baihua/cjBean/listCjBeanData.do'/>",
        queryParams:{
            //以下只作示例，并不通用，如需查询，模糊查询请用&li，精准查询用&eq,时间段查询目前尚未完善
            //'query.title&li':$("#title").val()
            
        }
    });
}
function add(){
    var title = "添加" ;
    var url = "<c:url value='/baihua/cjBean/editCjBean.do'/>";
    openEditWin(url,title);
}
function edit(id){
    if('' == id || id == undefined){
        var rows = $("#listTable").datagrid("getSelections");
        if(rows != null && rows != "" && rows.length == 1){
            id = rows[0].id;
        } else {
            msg("提示","请选择单条记录！");
            return;
        }
    }
    var title = "编辑" ;
    var url = "<c:url value='/baihua/cjBean/editCjBean.do?id='/>" + parseInt(id);
    openEditWin(url,title);
}

function detail(title,id){
    var winid = "cjBean";
    var width = 500;
    var height = 500;
    var url = "<c:url value='/baihua/cjBean/detailCjBean.do?id='/>" + id;
    my_window(winid, url, title, width, height);
}
function del(ids){
    basedel("<c:url value='/baihua/cjBean/delCjBeans.do'/>",ids);
}
function openEditWin(url,title){
    var winid = "cjBean";
    var width = 300;
    var height = 300;
    my_window(winid, url, title, width, height);
}
</script>
</head>
<body class="easyui-layout">
    <div region="north" border="false"   collapsed="false"  class="mybar" style="height: 50px;" align="left" >
    <!--查询操作，在该处，需写上查询的字段-->
        <table id="query" border="0" width="100%" height="100%">
            <tr height="100%" valign="middle">
                <td>
                    <!--输入查询条件：<input type="text" id="title" name="title"/>&nbsp;&nbsp;-->

                    <a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-search'" onclick="query();">查询</a>&nbsp;&nbsp;
                    <a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-remove'" onclick="reset()">重置</a></td>
            </tr>
        </table>
    </div>
    <div region="center" border="false">
        <table class="easyui-datagrid" id="listTable" width="100%" height="100%"
            toolbar="#toolbar"
            url="<c:url value='/baihua/cjBean/listCjBeanData.do'/>"
            data-options="fitColumns:true,nowrap:false, pagination:true,rownumbers:true,showFooter:true,fit:true">
            <thead>
                <tr>
                    <th data-options="field:'id',width:80" checkbox="true"></th>
                    
                    <th data-options="field:'opt',width:80,title:'操作',align:'center'" formatter="formatAction"></th>
                </tr>
            </thead>
        </table>
    </div>
    <div id="toolbar">
        <a href="#" class="easyui-linkbutton" iconCls="icon-add" plain="true" onclick="add()">添加</a>
        <a href="#" class="easyui-linkbutton" iconCls="icon-edit" plain="true" onclick="edit('')">修改</a>
        <a href="#" class="easyui-linkbutton" iconCls="icon-remove" plain="true" onclick="del('')">删除</a>
        <a href="#" class="easyui-linkbutton" iconCls="icon-undo" plain="true" onclick="unselect()">取消选中</a>
    </div>

</body>
</html>
